package Demo5;

public class test {
    public static void func(Animal animal){
        animal.eat();
    }

    public static void main(String[] args) {
        Animal animal = new Dog("小天",2);
        Dog dog =(Dog)animal;
        dog.bark();
        Animal animal1 = new Rabbit("白云",3);
        Rabbit rabbit  = (Rabbit) animal1;
        rabbit.jump();
    }
    public static void main2(String[] args) {
        Dog dog =new Dog("小天",2);
        func(dog);
        System.out.println("===========");
        Rabbit rabbit = new Rabbit("白云",3);
        func(rabbit);
    }
    public static void mainq(String[] args) {
        Animal animal = new Dog("旺财",3);
        animal.eat();
        Animal animal1 =new Rabbit("玉兔",2);
        animal1.eat();
    }
}
